package www.Demo.array;

import java.util.Arrays;

public class homework {
    public static void main(String[] args) {
        int[] array = new int[100];
        int i = 0;
        int t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, t8 = 0, t9 = 0, t10 = 0;
        while (i < array.length) {
            array[i] = (int) (Math.random() * 10 + 1);
            switch (array[i]) {
                case 1:
                    t1 += 1;
                    break;
                case 2:
                    t2 += 1;
                    break;
                case 3:
                    t3 += 1;
                    break;
                case 4:
                    t4 += 1;
                    break;
                case 5:
                    t5 += 1;
                    break;
                case 6:
                    t6 += 1;
                    break;
                case 7:
                    t7 += 1;
                    break;
                case 8:
                    t8 += 1;
                    break;
                case 9:
                    t9 += 1;
                    break;
                case 10:
                    t10 += 1;
                    break;
                default:
                    break;
            }
            i++;
        }
        System.out.println("1重复了：" + t1 + "次！\t" + "2重复了：" + t2 + "次！\t" + "3重复了：" + t3 + "次！\t" + "4重复了：" + t4 + "次！\t" + "5重复了：" + t5 + "次！\t" + "6重复了：" + t6 + "次！\t" + "7重复了：" + t7 + "次！\t" + "8重复了：" + t8 + "次！\t" + "9重复了：" + t9 + "次！\t" + "10重复了：" + t10 + "次！");
        System.out.println(Arrays.toString(array));
    }
}
